﻿using Dyao.Book.Entity;
using System.Linq.Expressions;

namespace Dyao.Book.Repository.Abstractions
{
    public interface IBookCatalogueContentRepository : IDataRepository<BookCatalogueContentEntity>
    {
        /// <summary>
        /// 批量添加
        /// </summary>
        /// <param name="entities">添加实体</param>
        /// <param name="cancellationToken">取消令牌</param>
        /// <returns></returns>
        Task BulkInsertAsync(IEnumerable<BookCatalogueContentEntity> entities, CancellationToken cancellationToken = default);

        /// <summary>
        /// 批量删除
        /// </summary>
        /// <param name="entities">实体</param>
        /// <param name="keyExpression">主键表达式</param>
        /// <param name="cancellationToken">取消令牌</param>
        /// <returns></returns>
        Task BulkDeleteAsync(IEnumerable<BookCatalogueContentEntity> entities, Expression<Func<BookCatalogueContentEntity, object>> keyExpression, CancellationToken cancellationToken = default);

        /// <summary>
        /// 根据章节编号获取正文集合
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="chapterId">章节编号</param>
        /// <param name="selector">选择器</param>
        /// <param name="cancellationToken">取消令牌</param>
        /// <returns></returns>
        Task<List<T>> GetListByChapterIdAsync<T>(string chapterId, Expression<Func<BookCatalogueContentEntity, T>> selector, CancellationToken cancellationToken = default);
    }
}
